<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=1200, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box1 {
            width: 200px;
            height: 200px;
            background: gray;
            padding: 20px;
            margin: 20px;
        }

        #box2 {
            width: 100px;
            height: 100px;
            background-color: green;
            padding: 5px;
        }
    </style>
</head>

<body>
    <div id="box1">
        <div id="box2">click me</div>
    </div>
    <script>
        const box = document.querySelector('#box2')
        box.addEventListener('click', (event) => {
            console.clear()
            console.log(`clientX=${event.clientX}, clientY=${event.clientY}`)
            console.log(`ScreenX=${event.screenX}, screenY=${event.screenY}`)
            console.log(`pageX=${event.pageX}, pageY=${event.pageY}`)
            console.log(`offsetX=${event.offsetX}, offsetY=${event.offsetY}`)
            console.log(`x=${event.x}, y=${event.y}`)
            console.log(`layerX=${event.layerX}, layerY=${event.layerY}`)
            console.log(`event.type=${event.type}`)
            console.log(`event.target=${event.target}`)
            console.log(`event.currentTarget=${event.currentTarget}`)
        }, true)

        const callback = function (event) {
            switch (event.type) {
                case "mouseover":
                    event.target.style.backgroundColor = 'red'
                    break;
                case "mouseout":
                    event.target.style.backgroundColor = "blue"
                    break;
            }
        }
        box.addEventListener("mouseover", callback)
        box.addEventListener('mouseout',callback)
    </script>
</body>

</html>